PickGenerator.generate   A
last analyzed

Complexity

Conditions 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 3
dl 0
loc 5
rs 10
c 0
b 0
f 0
cc 1
1
import Generator from './Base';
2
3
/**
4
 * Pick random item from the array.
5
 * @param {array} options list of available options
6
 * @returns {any} item
7
 * @requires int
8
 * @generator
9
 */
10
export default class PickGenerator extends Generator {
11
    generate(array) {
12
        const index = this.fatum.int(0, array.length - 1);
13
14
        return array[index];
15
    }
16
}
17